<?php

class Control_Admin_SmallTabs extends QUI_Control_Abstract
{
	function render()
	{
        $menu_title = $this->_extract('menu');

        $sub_menus = Q::ini('appini/admin_sub_menus/' . $menu_title);
        if (!is_array($sub_menus))
        {
            $sub_menus = array();
        }

		$current = $this->_extract('current');

		$out = "<ul>\n";
		foreach ($sub_menus as $menu)
		{
			if ($current == $menu['title'])
			{
				$li = '<li class="current">';
			}
			else
			{
				$li = '<li>';
			}
			$li .= '<a href="' . url($menu['udi']) . '"><span>';
			$li .= htmlspecialchars($menu['title']);
			$li .= "</span></a></li>\n";
			$out .= $li;
		}
        $out .= "</ul>\n";

        return $out;
	}
}
